import turtle
import random

turtle.shape("turtle")

max_radius = 200
turtle.color("red", "green")
turtle.pensize(5)

turtle.penup()
turtle.right(90)
turtle.forward(max_radius)
turtle.left(90)
turtle.pendown()
turtle.goto(0, 0)
turtle.speed(0)

angle = 0
distance = 0
step = 1

while distance > 0:
    if turtle.distance(0, 0) >= max_radius - 1:
        # turtle.write(turtle.distance(0,0))
        turtle.goto(0, 0)
        angle = turtle.towards(0, 0) + random.randint(-180, 180)
        turtle.setheading(angle)
        distance = 0

    turtle.forward(step)
    distance += step
    max_radius += step
    if max_radius >= max_radius * 10:
        max_radius = 0
        break